home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- Message-Id: <8902151819.AA14181@srhqla.UUCP>
- From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
- Reply-To: Michael M. Levin <srhqla!levin@uunet.UU.NET>
- Subject: v06i051: Uupoll
-
- Posting-number: Volume 6, Issue 51
- Submitted-by: Michael M. Levin <srhqla!levin@uunet.UU.NET>
- Archive-name: uupoll
-
- [I'm not certain I see the point in this, given "uucico -r1 -ssys". ++bsa]
-
- Uupoll is a utility which allows the user to force the polling of a
- remote system. It has one option which allows the user to force the
- poll to actually start, rather than waiting for cron's next pass. It
- is a Bourne shell-script, and is intended for use in HDB uucp systems.
- It is pretty well documented, and can easily be tailored to a specific
- system's unique requirements. It follows the general style of other
- scripts pertaining to the uucp system, and follows (as much as I can
- tell) the same general approach as the stock poll handler for HDB (the
- one called uudemon.poll), which has to be started by cron.
-
-
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # Uupoll
- # This archive created: Wed Feb 15 10:17:34 1989
- export PATH; PATH=/bin:$PATH
- if test -f 'Uupoll'
- then
- echo shar: will not over-write existing file "'Uupoll'"
- else
- cat << \SHAR_EOF > 'Uupoll'
- : # Uupoll (1.0)
- : #
- : # Bourne shell script to force polling of a remote system
- : #
- : # Written by:
- : # Michael M. Levin - Feb, 1988
- : #
- : # Copyright (c) 1988
- : # Michael M. Levin
- : #
- : # (levin@srhqla.UUCP, levin@magnus.UUCP)
- : #
- : #
- : # This script is intended for Public distribution. It shall
- : # not be distributed in any manner whatsoever, nor packaged for
- : # enhancement to a commercial product in any form, for profit.
- : # This agreement also stipulates that the users of this script
- : # will not remove the names of the origional Author nor this
- : # copyright notice from this script.
- : #
- : # Revision: Version 1.0 Feb 1988
- : #
- : # Developed for System V using HoneyDanBer uucp.
- : # (AT&T Basic Networking Utilities)
- : #
- : # Last Updated: Sat Feb 27 17:35:00 PST 1988
- : #
- : # Usage:
- : #
- : # This shell must be run by either super-user or uucp.
- : # It causes a poll request to be entered (or touched, if
- : # one already exists) for the specified system. Even if
- : # the file permissions are changed to allow execution by
- : # other users, the shell will abort itself.
- : # If the shell is started with only a system name, it simply
- : # creates an entry which will be handled the next time that
- : # uusched is run. To also cause uusched to start up, start
- : # it with a '-n' (NOW) option ahead of the system name.
- : # For example:
- : #
- : # Create entry only: Uupoll sysname
- : # Start uusched also: Uupoll -n sysname
-
- PATH=/bin:/usr/bin:/etc:/usr/lib/uucp
- export PATH
- SYS=/usr/lib/uucp/Systems # Full pathname to Systems file(s)
- SPOOL=/usr/spool/uucp # Mail system spool directory
- UUCP=uucp # Local uid name for uucp (usually uucp)
- MAIL=mail # Local gid name for mail (usually mail)
- ROOT=root # Local uid name for root (usually root)
- NOW=NO
- USAGE="\tusage: ${0} [-n] sysname"
- umask 022
- set +e
-
- : # Determine that we are either uucp or root:
-
- if id|cut -f2 -d\(|cut -f1 -d\)|grep "^${UUCP}$" > /dev/null
- then
- continue
- elif id|cut -f2 -d\(|cut -f1 -d\)|grep "^${ROOT}$" > /dev/null
- then
- continue
- else
- echo "${0}: you must be uucp to run this. FAILED"
- exit 2
- fi
-
-
- : # Verify that a system name has been passed to us:
-
- set -- `getopt n $*`
- if [ $? != 0 ]
- then
- echo $USAGE
- exit 2
- fi
- for i in $*
- do
- case $i in
- -n) NOW=YES; shift;; # Is 'NOW' flag set??
- --) shift; break;;
- esac
- done
- if [ $# != 1 ]
- then
- echo "${0}: you must specify system name. FAILED"
- exit 2
- fi
-
-
- : # Make sure system name exists in our local Systems file:
-
- if uuname | grep "^${1}$" > /dev/null
- then
- site=$1
- continue
- else
- echo "${0}: '"$1"' is not a valid system name. FAILED"
- exit 2
- fi
-
-
- : # If a spool directory doesn't exist for this system, create one.
-
- if [ ! -d $SPOOL/$site ]
- then
- mkdir $SPOOL/$site
- chown $UUCP $SPOOL/$site
- chgrp $MAIL $SPOOL/$site
- fi
-
-
- : # Create the poll entry in the specified system's spool directory.
-
- j=`expr $site : '\(.\{1,7\}\)'`
- touch $SPOOL/$site/C.${j}n0000
- chown $UUCP $SPOOL/$site/C.${j}n0000
- chgrp $MAIL $SPOOL/$site/C.${j}n0000
-
- : # If NOW option selected, start the scheduler.
-
- if [ $NOW = YES ]
- then
- touch $SPOOL/.Status/$site
- rm $SPOOL/.Status/$site
- nohup uusched > /dev/null &
- nohup uuxqt > /dev/null &
- fi
- SHAR_EOF
- fi # end of overwriting check
- # End of shell archive
- exit 0
-
-
-
- --
- +----+ P L E A S E R E S P O N D T O: +------+-*-*-*-*-*-*-*-*
- | Mike Levin, Silent Radio HeadQuarters, Los Angeles (srhqla) | No room for a *
- | Path:{aeras|csun|pacbell|pyramid|telebit}!srhqla!levin |'snappy remark'*
- +-------------------------------------------------------------+-*-*-*-*-*-*-*-*
-